﻿using Microsoft.OpenApi.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace WebApplication1.Swagger
{
    public static class SwaggerApi
    {
        /// <summary>
        /// Swagger分组信息，将进行遍历使用
        /// </summary>
        public static readonly List<SwaggerApiInfo> ApiInfos = new List<SwaggerApiInfo>()
        {
            new SwaggerApiInfo
            {
                UrlPrefix = SwaggerGroupingModel.GROUPNAME_TEST,
                Name = "测试模块",
                OpenApiInfo = new OpenApiInfo
                {
                    Version = "v1",
                    Title = "Api-Test",
                    Description =  "Api-测试模块"
                }
            },
            new SwaggerApiInfo
            {
                UrlPrefix = SwaggerGroupingModel.GROUPNAME_COMM,
                Name = "公共模块",
                OpenApiInfo = new OpenApiInfo
                {
                    Version = "v1",
                    Title = "WebApi-Comm",
                    Description =  "WebApi-公共模块"
                }
            }
        };



        /// <summary>
        /// 分组信息
        /// </summary>
        public class SwaggerApiInfo
        {
            /// <summary>
            /// URL前缀
            /// </summary>
            public string UrlPrefix { get; set; }

            /// <summary>
            /// 名称
            /// </summary>
            public string Name { get; set; }

            /// <summary>
            /// <see cref="Microsoft.OpenApi.Models.OpenApiInfo"/>
            /// </summary>
            public OpenApiInfo OpenApiInfo { get; set; }
        }
    }

    /// <summary>
    /// Swagerr分组模块
    /// </summary>
    public static class SwaggerGroupingModel
    {
        /// <summary>
        /// 公共数据模块
        /// </summary>
        public const string GROUPNAME_TEST = "test";

        /// <summary>
        /// 公共数据模块
        /// </summary>
        public const string GROUPNAME_COMM = "comm";
    }
}
